//引入封装的axios
import request from "../util/request";
//引入url封装的js
import {KEY,API_24H,API_7D, API_GEO_CITY,APInow, APIair,APIIndex, APILivingIndex, APISun}from './urlApi';
//未来24小时天气预报
//函数表达式
export const fetch24HourData = (locationID) => {
    return request.get(API_24H, {
        params: {
            location: locationID,
            key: KEY ,
        }
    })
}
//未来7日天气预报
export const fetch7DayData = (locationID) => {
    return request.get(API_7D, {
        params: {
            location: locationID,
            key:KEY,
        }
    })
}

// export {fetch24HourData,fetch7DayData}
//城市搜索请求
export const CitySearch = (cityName) => {
    return request.get(API_GEO_CITY, {
        params: {
            location:cityName,
            key:KEY,
        }
    })
}
//实时天气
export const CityNow = (locationID) => {
    return request.get(APInow, {
        params: {
            location:locationID,
            key:KEY,
        }
    })
}
//实时空气质量
export const Cityair = (locationID) => {
    return request.get(APIair, {
        params: {
            location:locationID,
            key:KEY,
        }
    })
}
//天气指数
export const Cityairindex = (locationID,type) => {
    return request.get(APIIndex, {
        params: {
            location:locationID,
            type:type,
            key:KEY,
        }
    })
}
export const livingdetail = (locationID,type) => {
    return request.get(APILivingIndex, {
        params: {
            location:locationID,
            type:type,
            key:KEY,
        }
    })
}
export const sunChart = (locationID,date) => {
    return request.get(APISun, {
        params: {
            location:locationID,
            date:date,
             key:KEY,
        }
    })
}